function ShowLevel(li)
{
	var menu = li.getElementsByTagName('ul')[0];
	menu.style.display = 'block';
	}
function HideSub(li)
	{
	var menu = li.getElementsByTagName('ul')[0];
	menu.style.display = 'none';
}
var aMatchTime = document.getElementsByClassName('match_time_icon');//比赛时间
var aSurplusTime = document.getElementsByClassName('ctn_match_count-down');//剩余时间
var aYear = new Array(), 
aMonth = new Array(), 
aDay = new Array(), 
aHour = new Array(), 
aMinute = new Array();
var times;
function GetTime(i){
		aYear[i] = aMatchTime[i].innerHTML.slice(5 , 9);
		aMonth[i] = aMatchTime[i].innerHTML.slice(10 , 12);
		aDay[i] = aMatchTime[i].innerHTML.slice(13 , 15);
		aHour[i] = aMatchTime[i].innerHTML.slice(16 , 18);
		aMinute[i] = aMatchTime[i].innerHTML.slice(19 , 21);
		var Match = new Date(parseInt(aYear[i]),parseInt(aMonth[i])-1,parseInt(aDay[i]),parseInt(aHour[i]),parseInt(aMinute[i]),0);
		var Now = new Date();
		times = parseInt(Match - Now)/1000;
}
function countDown(times , i){
	var day=0,
	  hour=0,
	  minute=0,
	  second=0;//时间默认值
	  GetTime(i);
	if(times > 0){
	  day = Math.floor(times / (60 * 60 * 24));
	  hour = Math.floor(times / (60 * 60)) - (day * 24);
	  minute = Math.floor(times / 60) - (day * 24 * 60) - (hour * 60);
	  second = Math.floor(times) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);
	}
	if (day <= 9) day = '0' + day;
	if (hour <= 9) hour = '0' + hour;
	if (minute <= 9) minute = '0' + minute;
	if (second <= 9) second = '0' + second;
	// console.log(day+"天:"+hour+"小时："+minute+"分钟："+second+"秒");
	aSurplusTime[i].innerHTML ="倒计时："+day+"天:"+hour+"："+minute+"："+second;
	times--;
}
function SurTime(i){
	var timer=null;
	timer = setInterval(function(){
			GetTime(i);
			countDown(times , i);
		},1000);
	if(times<=0){
   		clearInterval(timer);
  	}
}
SurTime(0);
SurTime(1);
SurTime(2);
SurTime(3);
